package com.ruoyi.yuanliao;


import com.ruoyi.common.security.annotation.EnableCustomConfig;
import com.ruoyi.common.security.annotation.EnableRyFeignClients;
import com.ruoyi.common.swagger.annotation.EnableCustomSwagger2;
import org.springframework.boot.SpringApplication;
import org.springframework.cloud.client.SpringCloudApplication;

import java.sql.*;

@EnableCustomConfig
@EnableCustomSwagger2
@EnableRyFeignClients
@SpringCloudApplication
public class YuanliaoApp {
    public static void main(String[] args) {
        SpringApplication.run(YuanliaoApp.class, args);
        System.out.println("(♥◠‿◠)ﾉﾞ  原料产商模块启动成功   ლ(´ڡ`ლ)ﾞ  \n" +
                " .-------.       ____     __        \n" +
                " |  _ _   \\      \\   \\   /  /    \n" +
                " | ( ' )  |       \\  _. /  '       \n" +
                " |(_ o _) /        _( )_ .'         \n" +
                " | (_,_).' __  ___(_ o _)'          \n" +
                " |  |\\ \\  |  ||   |(_,_)'         \n" +
                " |  | \\ `'   /|   `-'  /           \n" +
                " |  |  \\    /  \\      /           \n" +
                " ''-'   `'-'    `-..-'              ");


        /*String url = "jdbc:mysql://localhost:3306/shuju";
        String user = "root";
        String password = "root";

        try (Connection connection = DriverManager.getConnection(url, user, password)) {

            Statement statement = connection.createStatement();

            // 插入的SQL语句
            String sql = "INSERT INTO t_emp (name, age, phone) VALUES (?,?,?)";

            // 开始计时
            long start = System.currentTimeMillis();

            // 创建一个批次
            PreparedStatement pstmt = connection.prepareStatement(sql);
            int batchSize = 1000;
            for (int i = 1; i <= 5000000; i++) {
                pstmt.setString(1, "张三"+i);
                pstmt.setInt(2, 25);
                pstmt.setString(3, "18888888888");
                pstmt.addBatch();

                // 批次达到一定量后执行插入操作
                if (i % batchSize == 0) {
                    pstmt.executeBatch();
                }
            }
            // 执行剩下的插入操作
            pstmt.executeBatch();

            // 计算执行时间
            long end = System.currentTimeMillis();
            System.out.println("插入时间：" + (end - start) + "毫秒");

        } catch (SQLException ex) {
            ex.printStackTrace();
        }*/
    }
}
